<template>
  <el-dialog title="盘点日志" width="60%" :before-close="dialogClose" :visible.sync="show">
    <el-table :data="list.slice((currentPage-1)*pagesize,currentPage*pagesize)" style="width: 100%"
        row-key="id" border lazy>
      <el-table-column prop="goods_name" label="产品名称" align="center"></el-table-column>
      <el-table-column prop="old_num" label="盘点前数量" align="center"></el-table-column>
      <el-table-column prop="new_num" align="center" label="盘点后数量"></el-table-column>
      <el-table-column prop="loss" align="center" label="盈余"></el-table-column>
    </el-table>
    <el-pagination
      class="fen"
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="currentPage"
      :page-size="pagesize"
      :page-sizes="[5, 10, 20, 50]"      
      layout="total, sizes, prev, pager, next, jumper"
      :total="list.length">
      </el-pagination>
  </el-dialog>
</template>
 
<script>
export default {
  name: 'checkItem',
  props:['show','list'],
  data() {
    return {
        currentPage:1, //初始页
        pagesize:10, //每页的数据
        show_page:true,
        nowpage:1,
        maxpage:10,
    }
  },
  created: function() {
  },
  methods: {
    dialogClose:function(){
      //this.show = false
      this.$emit("func",{'key':'itemShow'})
    },
    handleSizeChange: function (size) {
        this.pagesize = size;
    },
    handleCurrentChange: function(currentPage){
      this.currentPage = currentPage;
    },
    changeLeft($event){
        $event.currentTarget.className="active";
    },
    removeLeft($event){
        $event.currentTarget.className ="tdclass";
    },
    exportExcel:function(){

    }
  }
}
</script>